package com.txunda.zhuohired.http;

import com.ants.theantsgo.base.BaseView;
import com.ants.theantsgo.config.Config;
import com.ants.theantsgo.httpTools.ApiTool2;
import com.lidroid.xutils.http.RequestParams;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/4/16 17:02
 * 功能描述：我的模块
 * 联系方式：jiahuanchen@126.com
 */

public class Info {
    private static String url = Config.BASE_URL + "Info/";

    /**
     * 我的首页
     *
     * @param token    用户token
     * @param baseView
     */
    public void infoHome(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "infoHome", params, baseView);
    }

    /**
     * 我的收藏
     *
     * @param token    用户token
     * @param baseView
     */
    public void collect(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "collect", params, baseView);
    }

    /**
     * 我的钱包
     *
     * @param token    用户token
     * @param baseView
     */
    public void wallet(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "wallet", params, baseView);
    }

    /**
     * 账户明细
     *
     * @param token    用户token
     * @param baseView
     */
    public void userMoney(String token, String p, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("p", p);
        apiTool.postApi(url + "userMoney", params, baseView);
    }

    /**
     * 银行卡列表
     *
     * @param token    用户token
     * @param baseView
     */
    public void bankList(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "bankList", params, baseView);
    }

    /**
     * 支持银行卡列表
     *
     * @param baseView
     */
    public void supportBankList(BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "supportBankList", params, baseView);
    }

    /**
     * 添加银行卡
     *
     * @param token       用户token
     * @param card_name   姓名
     * @param card_number 银行卡号
     * @param bank_id     开户行id
     * @param user_phone  手机号
     * @param user_number 身份证
     * @param baseView
     */
    public void bindBank(String token, String card_name, String card_number, String bank_id, String user_phone,
                         String user_number, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("card_name", card_name);
        params.addBodyParameter("card_number", card_number);
        params.addBodyParameter("bank_id", bank_id);
        params.addBodyParameter("user_phone", user_phone);
        params.addBodyParameter("user_number", user_number);
        apiTool.postApi(url + "bindBank", params, baseView);
    }

    /**
     * 解绑银行卡
     *
     * @param m_bank_id 银行卡id
     * @param baseView
     */
    public void delBank(String m_bank_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("m_bank_id", m_bank_id);
        apiTool.postApi(url + "delBank", params, baseView);
    }

    /**
     * 余额提现
     *
     * @param token     用户token
     * @param money     提现金额
     * @param m_bank_id 提现银行卡id
     * @param baseView
     */
    public void balanceWithdraw(String token, String money, String m_bank_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("money", money);
        params.addBodyParameter("m_bank_id", m_bank_id);
        apiTool.postApi(url + "balanceWithdraw", params, baseView);
    }

    /**
     * 提交家的位置
     *
     * @param token        用户token
     * @param home_lat     纬度
     * @param home_lng     经度
     * @param home_address 地址
     * @param baseView
     */
    public void subHomeAddress(String token, String home_lat, String home_lng, String home_address, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("home_lat", home_lat);
        params.addBodyParameter("home_lng", home_lng);
        params.addBodyParameter("home_address", home_address);
        apiTool.postApi(url + "subHomeAddress", params, baseView);
    }

    /**
     * 家的位置
     *
     * @param token    用户token
     * @param baseView
     */
    public void homeAddress(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "homeAddress", params, baseView);
    }

    /**
     * 求职进展
     *
     * @param token    用户token
     * @param type     1为全部 2为申请成功 3为拒绝面试 4为面试邀请
     * @param p        分页参数
     * @param baseView
     */
    public void jobMarch(String token,String type,String p, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("type",type);
        params.addBodyParameter("p",p);
        apiTool.postApi(url + "jobMarch", params, baseView);
    }
    /**
     * 面试状态操作
     *
     * @param token        用户token
     * @param id           详情ID
     * @param status       1 接受面试 2取消面试 3取消申请
     * @param baseView
     */
    public void setMarch(String token,String id,String status, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("id",id);
        params.addBodyParameter("status",status);
        apiTool.postApi(url + "setMarch", params, baseView);
    }

    /**
     * 面试状态操作
     *
     * @param feedback_text        反馈内容
     * @param from_phone           手机号
     * @param baseView
     */
    public void feedback(String feedback_text,String from_phone, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("feedback_text",feedback_text);
        params.addBodyParameter("from_phone",from_phone);
        apiTool.postApi(url + "feedback", params, baseView);
    }

    /**
     * 设置
     *
     * @param baseView
     */
    public void setConf( BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "setConf", params, baseView);
    }

    /**
     * 求职进展详情
     *
     * @param token        用户token
     * @param id           求职列表ID
     * @param baseView
     */
    public void jobMarchInfo(String token,String id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("id",id);
        apiTool.postApi(url + "jobMarchInfo", params, baseView);
    }

    /**
     * 进入修改密码
     *
     * @param token    用户token
     * @param baseView
     */
    public void inPassword(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "inPassword", params, baseView);
    }


    /**
     * 修改密码
     *
     * @param token    用户token
     * @param phone
     * @param code
     * @param password
     * @param rePassword
     * @param baseView
     */
    public void modPassword(String token, String phone,
                            String code,String password,String rePassword,BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("phone",phone);
        params.addBodyParameter("code",code);
        params.addBodyParameter("password",password);
        params.addBodyParameter("phone",phone);
        apiTool.postApi(url + "modPassword", params, baseView);
    }


    /**
     * 关于我们
     *
     * @param baseView
     */
    public void aboutUs( BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "aboutUs", params, baseView);
    }

    /**
     * 推广好友
     *
     * @param token    用户token
     * @param baseView
     */
    public void extension(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "extension", params, baseView);
    }

    /**
     * 求职分享
     *
     * @param token    用户token
     * @param p
     * @param baseView
     */
    public void shareJob(String token,String p, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("p",p);
        apiTool.postApi(url + "shareJob", params, baseView);
    }

    /**
     * 删除收藏
     *
     * @param token          用户token
     * @param collect_ids    收藏职位ID 用 , 分隔
     * @param baseView
     */
    public void delCollect(String token,String collect_ids, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("collect_ids",collect_ids);
        apiTool.postApi(url + "delCollect", params, baseView);
    }

}
